package cn.gjculture.shopping.api.util;

import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.http.HttpMethod;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

public class Test {


    public static void main(String[] args) throws Exception {

        String param ="{\"com\":\"yunda\",\"num\":\"3833284901498\"}";
//        String param ="{\"com\":\"zhongtong\",\"num\":\"75122591897785\"}";
        String customer ="EA16D8F9AD7A723CD5EC753635753934";
        String key = "KWmhABVF2582";
        String sign = DigestUtils.md5Hex(param+key+customer);
//        HashMap params = new HashMap();
//        params.put("param",param);
//        params.put("sign",sign);
//        params.put("customer",customer);

        MultiValueMap<String, String> params= new LinkedMultiValueMap<>();
        params.add("param",param);
        params.add("sign",sign.toUpperCase());
        params.add("customer",customer);
        String resp;
        try {
            resp=HttpClient.client("http://poll.kuaidi100.com/poll/query.do", HttpMethod.POST,params);
//            resp = new HttpRequest().postData("http://poll.kuaidi100.com/poll/query.do", params, "utf-8").toString();
            System.out.println(resp);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
